﻿SPListItemCopy = {
    addEvent: function (eventName, func) {
        if (window.attachEvent) {
            window.attachEvent("on" + eventName, func);
        } else if (window.addEventListener) {
            window.addEventListener(eventName, func, false);
        }
    }
};

var locPath = location.pathname.toLowerCase();
if (locPath.indexOf("/_layouts/") < 0 && locPath.indexOf("/lists/") >= 0 && locPath.indexOf("/dispform.aspx") < 0 && locPath.indexOf("/newform.aspx") < 0 && locPath.indexOf("/editform.aspx") < 0) {
    var isInitialTab = (GetUrlKeyValue("InitialTabId", false) == "Ribbon.ListItem");

    if (!(window.jQuery) && isInitialTab) {
        document.write('<script type="text/javascript" src="../SPListItemCopyFiles/jquery-1.4.4.min.js"></' + 'script>');
    }
    if (!(window.SPListKit)) {
        document.write('<script type="text/javascript" src="../SPListItemCopyFiles/splistkit-ribbon-1.0.2.js"></' + 'script>');
    }
    document.write('<script type="text/javascript" src="../SPListItemCopyFiles/Resources.js"></' + 'script>');
    SPListItemCopy.addEvent("load", function () {
        var curLang = _spPageContextInfo.currentLanguage;
        if (SPListItemCopy.DefaultLanguage != curLang && SPListItemCopy.RibbonResources[curLang]) {
            SPListKit.RibbonInitOptions.localize = true;
            var key = "Ribbon.ListItem.Actions.SPListItemCopy";
            SPListKit.RibbonResources[key] = SPListItemCopy.RibbonResources[curLang];
            if (isInitialTab) SPListKit.localizeStaticRibbonControl(key);
            SPListKit.overrideRibbonInitFunc();
        }
    });
}
